"""
@Time    : 2025/7/22 15:18
@Author  : white.tie
@File    : http.py
@Desc    : http 授权
"""

from typing import Annotated

import uvicorn
from fastapi import FastAPI, Depends
from fastapi.responses import HTMLResponse
from fastapi.security import HTTPBasic, HTTPBasicCredentials

app = FastAPI()
security = HTTPBasic()


@app.get("/users/me")
async def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
    return {"username": credentials.username, "password": credentials.password}

if __name__ == '__main__':
    uvicorn.run(app)